package com.soft.service;

import com.soft.entity.Student;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.util.Assert;

import java.util.List;


@SpringBootTest
public class StudentServiceTest {
    @Autowired
    private StudentService studentService;
    @Test
    public void quallerAllTset(){
        List<Student> studentList=studentService.quallerAll();
        Assert.isTrue(studentList.size()>10,"没有10个学生");
        Assert.notNull(studentList,"没有学生");
    }

    @Test
    public void insertTset(){
        int num=studentService.insert("张三","18","北京","1");
        Assert.isTrue(num>0,"添加失败");
    }

    @Test
    public void UpdateNameByIdTset(){
        int num=studentService.updateNameById(29,"李四");
        Assert.isTrue(num>0,"修改成功");
    }

    @Test
    public void deleteByIdTset(){
        int num=studentService.delete(28);
        Assert.isTrue(num>0,"删除失败");
    }

    @Test
    public void updateStudentClassTest(){
        int num=studentService.updateStudentClass("李四","计算机科学与技术2班");
        Assert.isTrue(num>0,"修改失败");
    }

}
